package com.company.statis.controller;


import com.company.statis.feign.UserFeignService;
import com.company.statis.service.StatisticsDailyService;
import com.company.utils.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-04-24
 */
@RestController
@RequestMapping("/staservice/sta")
@CrossOrigin
public class StatisticsDailyController {

    @Resource
    private StatisticsDailyService dailyService;

    //统计某一天注册人数,生成统计数据
    @PostMapping("/registerCount/{day}")
    public R registerCount(@PathVariable("day") String day) {
        dailyService.saveStatistics(day);
        return R.ok();
    }

    //查询全站统计数据生成图表
    @GetMapping("/showData/{type}/{begin}/{end}")
    public R show (@PathVariable String type, @PathVariable String begin, @PathVariable String end) {
        Map<String, Object> map = dailyService.show(type, begin, end);
        return R.ok().data(map);
    }

}

